package com.yanqu.road.server.cmd.activity.dunhuangshiku;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.dunhuangshiku.DunHuangShiKuProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.cross.battle.dunhuangshiku.DunHuangShiKuMgr;
import com.yanqu.road.server.protocol.CrossProtocol;

import java.util.List;

/**
 * @Author cwq
 * @Date 2021/04/20
 */

@Cmd(code = CrossProtocol.C2_DUN_HUANG_SHI_KU_GET_ACTIVE_USER_INFO, desc = "敦煌石窟 区服同步活跃玩家数据")
public class CrossDunHuangShiKuSynAcitveUserInfoCmd extends CrossUnionCommand {

    int activityId;
    List<DunHuangShiKuProto.DunHuangShiKuActiveUserInfo> activeUserInfoList;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        DunHuangShiKuProto.DunHuangShiKuSynActiveUserInfoToCrossMsg msg = DunHuangShiKuProto.DunHuangShiKuSynActiveUserInfoToCrossMsg.parseFrom(packet.getBytes());
        activityId = msg.getActivityId();
        activeUserInfoList = msg.getActiveUserInfoListList();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        DunHuangShiKuMgr.receiveActiveUserInfo(activityId,serverId, activeUserInfoList, groupId);
    }

    @Override
    public void sendData() {

    }
}
